-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(viewpatient): added labs tab to ViewPatient #1987
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/bcb6xwod2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubencgt let me know if you need any help getting the feedback addressed!
src/patients/labs/Labs.tsx
Outdated
@@ -0,0 +1,63 @@ | |||
import React, { useEffect } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need tests for this component:
- test that the table renders with the correct labs
- test that the content of the table is correct
- test that when no labs are returned, the warning message appears
src/labs/labs-slice.ts
Outdated
|
||
interface LabsState { | ||
isLoading: boolean | ||
labs: Lab[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be added as part of the patient slice. It seems like this functionality is part of the patient module, so therefore it makes sense to have the patient slice own this state update. @fox1t any thoughts here?
I imagine the patient slice getting a new state field called labs
, and then a thunk function called findLabsPatientId
and the corresponding reducers.
src/labs/labs-slice.ts
Outdated
@@ -0,0 +1,42 @@ | |||
import { createSlice, PayloadAction } from '@reduxjs/toolkit' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add tests for this functionality. Of course the test implementation might change a little if we move it to the patient slice, however, the test concepts shouldn't.
- test for the
fetchPatientLabs
thunk dispatchingfetchLabsStart
- test that it calls the
LabRepository
correctly - test that it dispatches
fetchLabsSuccesss
with the correct data - test that the
fetchLabsStart
reducer update updates the is loading state correctly - test that the
fetchLabsSuccess
reducer updates the labs list and loading state correctly
src/clients/db/LabRepository.ts
Outdated
@@ -6,6 +6,18 @@ export class LabRepository extends Repository<Lab> { | |||
constructor() { | |||
super(labs) | |||
} | |||
|
|||
async searchPatientLabs(patientId: string): Promise<Lab[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add tests to show that this is working correctly.
f74874c
to
7bca96e
Compare
08709bf
to
69eb7a1
Compare
@rubencgt the MacOS build is failing. I'm guessing due to a missing mock somewhere. Let me know if you need help resolving it. |
A patient can see all his requests for labs in the Labs tab fix HospitalRun#1972
@jackcmeyer for some reason I can't reproduce the issue locally (I use MacOS 10.15.4), |
I was able to reproduce (I also use a Mac). I'll investigate a fix. |
A patient can see all his requests for labs in the Labs tab
fix #1972